
package org.wing.panel;

import com.tool.tcpimg.UIUtils;
import org.come.until.FormsManagement;
import org.come.until.Music;

import javax.swing.*;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

public class LHMainFrame extends JInternalFrame implements MouseListener {
    private int first_x;
    private int first_y;
    private LHMainPanel lhMainPanel = new LHMainPanel();

    public static LHMainFrame LHMainFrame() {
        return (LHMainFrame)FormsManagement.getInternalForm(866).getFrame();
    }

    public LHMainFrame() {
        this.add(this.lhMainPanel);
        this.setBorder(BorderFactory.createEmptyBorder());
        ((BasicInternalFrameUI)this.getUI()).setNorthPane((JComponent)null);
        this.setBounds(200, 60, 561, 537);
        this.setOpaque(false);
        this.pack();
        this.setBackground(UIUtils.Color_BACK);
        this.setVisible(false);
        this.addMouseMotionListener(new MouseMotionListener() {
            public void mouseMoved(MouseEvent e) {
            }

            public void mouseDragged(MouseEvent e) {
                if (LHMainFrame.this.isVisible()) {
                    int x = e.getX() - LHMainFrame.this.first_x;
                    int y = e.getY() - LHMainFrame.this.first_y;
                    LHMainFrame.this.setBounds(x + LHMainFrame.this.getX(), y + LHMainFrame.this.getY(), LHMainFrame.this.getWidth(), LHMainFrame.this.getHeight());
                }

            }
        });
        this.addMouseListener(this);
    }

    public void mouseClicked(MouseEvent e) {
    }

    public void mousePressed(MouseEvent e) {
        Music.addyinxiao("关闭窗口.mp3");
        if (e.isMetaDown()) {
            FormsManagement.HideForm(866);
        } else {
            FormsManagement.Switchinglevel(866);
        }

        this.first_x = e.getX();
        this.first_y = e.getY();
    }

    public void mouseReleased(MouseEvent e) {
    }

    public void mouseEntered(MouseEvent e) {
    }

    public void mouseExited(MouseEvent e) {
    }

    public LHMainPanel getLhMainPanel() {
        return lhMainPanel;
    }

    public void setLhMainPanel(LHMainPanel lhMainPanel) {
        this.lhMainPanel = lhMainPanel;
    }
}
